class Animal{
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
    public Animal(){//父类构造方法
        System.out.println("这是父类构造方法");
    }
    public void eat(){
        System.out.println(name+"正在吃饭");
    }
}
class dog extends Animal{
    public dog(){
        super();
    }
    public void eat(){
        System.out.println("这是小狗1正在吃饭");
    }

}
class cat extends Animal {
    public void eat(){
        System.out.println("这是小猫1正在吃饭");
    }
}
public class MutIL {
    public static void main(String[] args) {
        /*Animal animal1=new Animal();
        animal1.setName("wangcai");
        animal1.eat();
        System.out.println(animal1.getName());*/
        Animal dog1=new dog();
        dog1.setName("小狗1你好啊");
        dog1.eat();
        Animal cat1=new cat();
        cat1.eat();

    }
}
